package fileIO;

import java.util.List;

import org.hibernate.Session;

import model.Model;

public class StoreData {
	public void saveModel(Session session, List<Model> modelList) throws Exception {

		Model model = new Model();
		try {
			
			session.beginTransaction();
			for (int i = 0; i < modelList.size(); i++) {
				model = (Model) modelList.get(i);
				session.save(model);
			}
			session.getTransaction().commit();
		} catch (Exception e) {
			e.printStackTrace();
			session.getTransaction().rollback();
		} 
	}
}
